1. Field of the Invention
This invention relates to a moving picture encoding method and apparatus in which an input bitstream is decoded to picture signals which are then re-converted into and outputted as a bitstream.
2. Description of the Related Art
Recently, the so-called MPEG (Moving Picture Experts Group) or MPEG2, which combines the encoding of picture signals for compression with redundancy reducing processing by orthogonal transform such as discrete cosine transform (DCT) with motion compensation MC, is in widespread use.
Non-compressed picture data is compressed by, for example, the above-mentioned MPEG technique, into coded pictures, such as intra-coded pictures (I-pictures), an inter-frame predictive coded pictures (P-pictures) or bi-directionally predictive coded pictures (B-pictures), for recording on a storage medium such as a magneto-optical disc or transmission over a telephone network.
The manner in which signals compressed in accordance with the MPEG system are reproduced is hereinafter explained.
On a recording medium, there is recorded encoded data of a data stream shown in FIG. 1A. This data stream, recorded as shown in FIG. 1A, is decoded and displayed in a picture sequence shown in FIG. 1B. It is noted that xe2x80x9cIxe2x80x9d, xe2x80x9cPxe2x80x9d and xe2x80x9cBxe2x80x9d annexed to the respective pictures as symbols stand for the distinction between the I-, P- and B-pictures, with suffix numerals specifying the so-called temporal reference denoting the display sequence of the pictures in a group-of-pictures (GOP).
For reproducing encoded data of the data stream, shown in FIG. 1A, the picture 10 is first reproduced. Since the I-picture is complete in one frame, the picture I0 can be decoded by itself without decoding other pictures. Based on the decoded picture I0, a picture P2, encoded by forward predictive coding, is decoded. Since the P-picture is predictive coded from a temporally previous I- or P-picture, the picture I0 needs to be decoded before decoding this picture P2 in the case of a conventional recording/reproducing apparatus. Then, based on the decoded pictures I0 and P2, a bidirectionally predictive coded picture B1 is decoded. Since the B-picture is bidirectionally predictive coded from the temporally previous and succeeding I- or P-pictures, the pictures I0 andP2 need to be decoded before decoding the picture B1. The encoded data of the data stream shown in FIG. 1A is decoded in the sequence of I0xe2x86x92P2xe2x86x92B1xe2x86x92P4xe2x86x92B3xe2x86x92P6xe2x86x92B5xe2x86x92I8xe2x86x92B7xe2x86x92P10xe2x86x92B9xe2x86x92 . . . .
For displaying the pictures, decoded in the above-mentioned sequence, the picture sequence is interchanged, as shown in FIG. 12B, to display the pictures in the sequence of I0xe2x86x92B1xe2x86x92P2xe2x86x92B3xe2x86x92P4xe2x86x92B5xe2x86x92P6xe2x86x92B7xe2x86x92I8xe2x86x92B9xe2x86x92P10xe2x86x92 . . . .
Incidentally, when a bitstream of encoded moving pictures is to be recorded on a recording medium, if the bit rate (hereafter, xe2x80x9cbitratexe2x80x9d) of the bitstream exceeds an upper limit of the recording rate of the recording medium, the bitstream occasionally cannot be recorded in a normal manner on the recording medium. Also, when decoding the bitstream of encoded moving pictures, if the bitrate of the bitstream deviates from a certain bitrate range as set by a buffer, failure in decoding is likely to occur.
It is therefore an object of the present invention to provide a moving picture encoding method and apparatus in which the bitrate of the bitstream of encoded moving pictures can be brought into a pre-set bitrate range.
In one aspect, the present invention provides a moving picture encoding apparatus including comparator means for comparing the bitrate of a unit domain of a bitstream, pictures of which are previously encoded, to a reference value, and bitrate conversion means for converting the unit domain of the bitstream so that the bitrate will be not higher than the reference value if the comparator means verifies that the bitrate of the unit domain of the bitstream is in excess of the reference value, the bitrate conversion means outputting the bitstream with the bitrate remaining unchanged if the comparator means verifies that the bitrate of the unit domain of the bitstream is not in excess of the reference value.
In the present moving picture encoding apparatus, the bitrate of the bitstream is kept at all times below the reference value based on results of detection by the comparator means.
In another aspect, the present invention provides a moving picture encoding method including the steps of comparing the bitrate of a unit domain of a bitstream, pictures of which are previously encoded, to a reference value, and converting the unit domain of the bitstream so that the bitrate will be not higher than the reference value if the comparator step verifies that the bitrate of the unit domain of the bitstream is in excess of the reference value, the bitrate conversion step outputting the bitstream with the bitrate remaining unchanged if the comparator step verifies that the bitrate of the unit domain of the bitstream is not in excess of the reference value.
In the present moving picture encoding method, the bitrate of the bitstream is kept at all times below the reference value based on the results of comparison between the reference value and the bitrate.
In still another aspect, the present invention provides a moving picture encoding apparatus including comparator means for comparing the bitrate of a unit domain of a bitstream, pictures of which are previously encoded, to a reference value, re-encoding means for decoding a unit domain of an input bitstream into picture signals and re-encoding a unit domain of the input bitstream into picture signals if the comparator means verifies that the bitrate of the unit domain of the bitstream is in excess of the reference value, the re-encoding means re-encoding the decoded picture signals into a unit domain of a bitstream having a bitrate not higher than the reference value, and substitution means for substituting the unit domain of the bitstream re-encoded by the re-encoding means for the unit domain of the input bitstream and outputting the resulting bitstream.
In the present encoding apparatus, the bitstream is decoded and re-encoded, if, based on the results of detection by the comparator means, the bitrate of the bitstream is in excess of the reference value.
In yet another aspect, the present invention provides a moving picture encoding method including a comparator step for comparing the bitrate of a unit domain of a bitstream, pictures of which are previously encoded, to a reference value, a re-encoding step for decoding a unit domain of an input bitstream into picture signals and re-encoding a unit domain of the input bitstream into picture signals if the comparator step verifies that the bitrate of the unit domain of the bitstream is in excess of the reference value, the re-encoding step re-encoding the decoded picture signals into a unit domain of a bitstream having a bitrate not higher than the reference value, and a substitution step for substituting the unit domain of the bitstream re-encoded by the re-encoding step for the unit domain of the input bitstream and outputting the resulting bitstream.
In the present encoding method, the bitstream is decoded and re-encoded, if, based on the results of detection by the comparator step, the bitrate of the bitstream is in excess of the reference value.
With the moving picture encoding method and apparatus according to the present invention, if the bitrate of a unit domain is detected to be in excess of a reference value, the unit domain is converted so that the unit domain of the bitstream will have a bitrate not larger than the reference value. If conversely the bitrate of a unit domain is detected not to be in excess of a reference value, the bitstream is outputted with the bitrate remaining unchanged. Thus, the bitstream can be recorded as normally with the bitrate below the recording rate of the recording medium to evade the failure of the buffer memory due to the increased bitrate.
With the moving picture encoding method and apparatus according to the present invention, if the bitrate of a unit domain is detected to be in excess of a reference value, the unit domain of the bitstream is decoded into picture signals, and the decoded picture signals are re-encoded into a unit domain of a bitstream having a bitrate lower than the reference value. The re-encoded unit domain of the bitstream is substituted for the unit domain of the input bitstream. Thus, the bitrate of the bitstream, moving picture of which are previously encoded, can be comprised within a pre-set range.